<?php

#--------------------------------------------------
# ALL INCLUDES + STANDARD-VALUES
#--------------------------------------------------
include_once ("include/config.inc");
include_once ("include/template.inc");
include_once ("include/class.db.php5");
include_once ("include/class.tools.php5");
$svo = new db("svoptik");
$tools = new tool();

include_once ("include/global_fix_extern.inc");

#--------------------------------------------------
# CREATE TEMPLATE
#--------------------------------------------------
$t = new Template("templates", "keep");
$t->set_file(array (
	"page" => "svoptik.tpl",
	"navi" => "navi.tpl",
	"ticker" => "ticker.tpl",
	"link" => "links.tpl"
));
#--------------------------------------------------
$t->set_var(array (
	"FORWARD" => ""
));

#--------------------------------------------------
# CREATE NAVIGATION RIGHT
#--------------------------------------------------
$links = "";
$url[0] = array (
	"URL" => "javascript:;",
	"ONCLICK" => "onClick=\"javascript:window.open('new_link.php5','','width=400,height=563,locationbar=no,scrollbars=no,statusbar=no,resizable=no')\" ",
	"URL-TEXT" => "Link aufnehmen"
);
for ($i = 0; $i < count($url); $i++) {
	$links .= "
	        <tr height=\"15\">
				<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
				<td valign=\"top\"><a href=\"" . $url[$i]['URL'] . "\" " . $url[$i]['ONCLICK'] . " class=\"sitenav\">" . $url[$i]['URL-TEXT'] . "</a></td>
				<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
			</tr>
	       ";
}
$t->set_var(array (
	"LINKS" => $links,
	"BANNER" => $banner
));
$right_nav = $t->parse("", "navi", true);
#--------------------------------------------------

#--------------------------------------------------
# CREATE ALL-TIME SAME THINGS
#--------------------------------------------------
include_once ("include/sameThings.php5");

#--------------------------------------------------

#--------------------------------------------------
# CREATE CONTENT "LINKS"
#--------------------------------------------------
$content = "";
$sql = $svo->doSQL("select distinct link_cat from " . $table['Links'] . " order by link_cat asc;");

while ($tupel = mysql_fetch_array($sql)) {
	$link_sql = $svo->doSQL("select * from " . $table['Links'] . " where link_cat='" . $tupel['link_cat'] . "' order by link_id asc;");
	$set_links = "";
	while ($link_data = mysql_fetch_array($link_sql)) {
		$url = "<a href=\"" . $link_data['link_url'] . "\" class=\"text\" target=\"_blank\">" . $link_data['link_text'] . "</a>";
		$set_links .= "
				    <tr>
					    <td width=\"33%\" valign=\"top\" class=\"text\">" . $url . "</td>
					    <td width=\"67%\" valign=\"top\" class=\"text\">" . $link_data['link_descr'] . "</td>
				    </tr>
				     ";
	}
	$t->set_var(array (
		"ALL-LINKS" => $set_links
	));
	$content .= $t->parse("", "link", true);
}
#--------------------------------------------------

#--------------------------------------------------
# PARSE & OUTPUT
#--------------------------------------------------
$t->set_var(array (
	"sitenav" => "LINKS",
	"ticker" => $ticker,
	"content" => $content . "<br>",
	"navi" => $right_nav,
	"SYNCHRONIZE" => " "
));

$t->parse("ALL", "page", true);
$t->p("ALL");
?>
